The following calls operate on the static 3D sound setting for a track. By constantly setting the value it is possible for an application to make a track's sound move in 3D space. If it is necessary to store dynamically changing 3D sound settings for the track, this can be done using the modifier track mechanism in conjunction with a tween track. This process is described in the following section.
SetTrackSoundLocalizationSettings replaces the current 3D sound settings for the specified track with the new SSpLocalizationData record contained in the settings handle. The effect of the new 3D sound setting takes place immediately. This call always stores the new record passed, even if the track or the computer is not capable of actually meeting the request. You can pass a nil handle to indicate that no 3D sound effects should be used for this track. When the movie is saved, the 3D sound settings is saved with it.
SetTrackSoundLocalizationSettings makes a copy of the handle passed, so the caller is responsible for disposing of the settings handle.
pascal OSErr SetTrackSoundLocalizationSettings (
Track theTrack,
Handle settings)
The following example code shows how to set the static 3D sound setting for a track using SetTrackSoundLocalizationSettings .
void setTrackSoundLocalization(Track t)
{
SSpLocalizationData loc;
Handle h;
OSErr err;
loc.cpuLoad = 0;
loc.medium = kSSpMedium_Air;
loc.humidity = 0;
loc.roomSize = 250;
loc.roomReflectivity = -5;
loc.reverbAttenuation = -5;
loc.sourceMode = kSSpSourceMode_Localized;
loc.referenceDistance = 1;
loc.coneAngleCos = 0;
loc.coneAttenuation = 0;
loc.currentLocation.elevation = 0;
loc.currentLocation.azimuth = 0;
loc.currentLocation.distance = 2;
loc.currentLocation.projectionAngle = 0;
loc.currentLocation.sourceVelocity = 0;
loc.currentLocation.listenerVelocity = 0;
loc.reserved0 = 0;
loc.reserved1 = 0;
loc.reserved2 = 0;
loc.reserved3 = 0;
loc.virtualSourceCount = 0;
err = PtrToHand(&loc, &h, sizeof(loc));
err = SetTrackSoundLocalizationSettings(t, h);
DisposeHandle(h);
}
GetTrackSoundLocalizationSettings returns a handle containing a copy of the current 3D sound settings for the specified track.
pascal OSErr GetTrackSoundLocalizationSettings (
Track theTrack,
Handle *settings)
| Previous | Chapter Contents | Chapter Top | Next |